let express = require('express');
let hotdata = require('./data/home/hotdata')
let cors = require('cors')
let bodyParser =require('body-parser')
let hotcity = require('./data/hotcity/index.js')
let searchdata=require('./data/search/index.js')
let detaildata=require('./data/details/index.js')
let commentdata=require('./data/comment/index.js')
let orderdata=require('./data/order/index.js')

let app =express();
app.use(cors())
app.use(bodyParser.urlencoded({extended:false}))

app.get('/homehote',function(req,res){

    let city = req.query.city;
    res.send(hotdata)
})

app.get('/hotcity',function(req,res){
    res.send(hotcity)
})
app.get('/search/:city/:keyword/:page',function(req,res){
    let city=req.params.city;
    let keyword =req.params.keyword;
    let page =req.params.page
    res.send(searchdata)
})
// 详情接口
app.post('/detail',function(req,res){
    let id =req.body.id;
    res.send(detaildata)
    console.log(id)
})
//房屋评价
app.get('/dcomment',function(req,res){
    let id =req.query.id;
    let page =req.query.page;
    res.send(commentdata)
})

//购物车数据请求接口
app.get('/shopcar',function(req,res){
    res.send(orderdata)
})

app.listen(3005,function(){
    console.log('开机成功')
})